<?php
require_once "common.php";
$pid=$_GET[pid];
$currentPage=$_GET[page];
if(is_null($currentPage)){
	$currentPage=1;
}
@$article=new article('','','',$pid,'','');
$list=$article->partList();
$num=count($list)-1;//文章总条目数
$subPage=4;//单页显示数量
?>
<table>
	<tr style="background-color:#4682B4;">
		<td align="center" width="80px">编号</td>
		<td align="center" width="300px">文章标题</td>
		<td align="center" width="300px">添加时间</td>
		<td align="center" width="150px">操作</td>
	</tr>
	<?php
	$flag=($currentPage-1)*$subPage;
	//var_dump($currentPage);
	for($i=0;$i<$subPage;$i++){
		if($flag+$i>=$num){
			break;
		}
	?>
	<tr <?php if(fmod($i,2)==0){
			echo "style=\"background-color:#00bfff;\"";
	}		echo "style=\"background-color:#B0E0E6;\"";
	?>>
		<td align="center"><?php echo $list[$flag+$i][aid];?></td>
		<td align="center"><?php echo $list[$flag+$i][title];?></td>
		<td align="center"><?php echo $list[$flag+$i][time];?></td>
		<td align="center"><a href="./article_edit.php?aid=<?php echo $list[$flag+$i][aid];?>">修改</a>|<a href="./article_del.php?aid=<?php echo $list[$flag+$i][aid];?>">删除</a></td>
	</tr>
	<?php
	}
	?>
	<tr>
		<td colspan=4 align="center">
		<a href="./editor.php?pid=<?php echo $pid; ?>" target="show" >添加文章</a>
		<?php $page=new page($num,$subPage,$currentPage,"./article_list.php?pid=".$pid);
				$page->outPut(); ?>
		</td>
	</tr>
</table>
